package com.why.simpleboot.core.core.aop.interceptor;

import com.why.simpleboot.core.core.aop.entity.MethodInvocation;

/**
 * @program: why-simpleboot-framework
 * @description:实现该拦截器的类进化出了可以排序的功能
 * @author: @why
 * @create: 2021-05-27 14:10
 **/
public abstract class Interceptor {
    private int order = -1;

    /**
     * 想要完成拦截 就必须调用该方法
     *
     * @param obj
     * @return
     */

    public  boolean supported(Object obj){
        return true;
    }

    /**
     * 执行目标方法 执行前 做一些拦截
     *
     * @param methodInvocation
     * @return
     */
    public abstract Object proceed(MethodInvocation methodInvocation);

    public int getOrder() {
        return order;
    }
}
